It is well known that side channel analysis during a sensitive computation, for example a cryptographic computation, and fault attacks leads to extract secret from a device. Such attacks can use timing measurement, power consumption measurement, electromagnetic emission measurement, fault injection, etc
It is always desirable to find efficient ways against physical attacks having a minimum impact, notably in terms of memory footprint and execution time.
In order to counter these attacks, embedded software countermeasures are implemented in secure devices. These software countermeasures are mainly based on one or several of the followings:                Masking sensitive data with random numbers to un-correlate signals from the sensitive values,        Masking sensitive treatments in order to cancel the possibility to know which branch of a software code has been taken,        Adding some extra code, that assures the correctness of the execution, typically rerun sensitive operations or extra consistent code with control of consistency, etc,        Adding extra code to desynchronize execution in case of loops of execution, which correspond to situations of attack,        Doubling the computation,        Doing the inverse operation,        Adding some fake operations.        
In general the implementation of such countermeasure Is costly in term of RAM/ROM footprint and execution time.
In the case of the sensitive computation concerned by the invention the computation is composed by two different and independent branches. In general, one of the sensitive branches is first executed and then the second one.
There exists indeed a need to mask the treatment of such sensitive computation to avoid side channel attacks and to be able to cross-check the coherence of intermediary results depending on the boolean or arithmetic properties of the performed calculations, for example in the case of a DES(M,K) calculation which is equal to the complement of DES(complement M, complement K).
Further alternative and advantageous solutions would, accordingly, be desirable in the art.